import { localStorage } from './storage'

// 操作token的三个方法
const key = 'geek' // 键名
const refresh = 'refresh_token'

// 保存token,保存一天
export const setToken = (token) => {
  localStorage.set(key, token, { exp: 60 * 60 * 24 })
}

// 获取token
export const getToken = () => {
  return localStorage.get(key)
}

// 删除token
export const removeToken = () => {
  localStorage.delete(key)
}

// 保存续签的token
export const setRefreshToken = (refToekn) => {
  localStorage.set(refresh, refToekn)
}

// 获取续签的token
export const getRefreshToken = () => {
  return localStorage.get(refresh)
}
